package o;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.gamebox.service.welfare.campaign.bean.CampaignSectionCardItemBean;
import com.huawei.gamebox.service.welfare.campaign.card.BaseCampaignCard;
import o.exp.d;

public class fbv extends BaseCampaignCard {
    private View ʻ;
    private RelativeLayout ʼ;
    private ImageView ˋ;
    private TextView ˎ;
    private TextView ॱ;
    private boolean ॱॱ;
    private ImageView ᐝ;

    public fbv(Context context, boolean z) {
        super(context);
        ॱ("CampaignSectionCard");
        this.ॱॱ = z;
    }

    public cgz ˏ(View view) {
        view.setBackgroundResource(exp$e.ᐝ);
        this.ʼ = (RelativeLayout) view.findViewById(d.ˊˊ);
        this.ˎ = (TextView) view.findViewById(d.ˊ);
        this.ॱ = (TextView) view.findViewById(d.ˏ);
        this.ˋ = (ImageView) view.findViewById(d.ꞌ);
        this.ᐝ = (ImageView) view.findViewById(d.ʼॱ);
        this.ʻ = view.findViewById(d.ʽॱ);
        LayoutParams layoutParams = (LayoutParams) this.ʻ.getLayoutParams();
        layoutParams.setMarginStart(epv.ˊ() + this.ʼॱ.getResources().getDimensionPixelSize(exp$a.ˊ));
        this.ʻ.setLayoutParams(layoutParams);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        int i = 4;
        super.ˏ(cardBean);
        if (this.ॱॱ) {
            this.ʻ.setVisibility(4);
        } else {
            View view = this.ʻ;
            if (ˊᐝ()) {
                i = 0;
            }
            view.setVisibility(i);
        }
        CampaignSectionCardItemBean campaignSectionCardItemBean = (CampaignSectionCardItemBean) cardBean;
        CharSequence v_ = campaignSectionCardItemBean.v_();
        if (TextUtils.isEmpty(v_)) {
            v_ = "";
        }
        this.ˎ.setText(v_);
        i = campaignSectionCardItemBean.ˊ();
        this.ॱ.setText(ContentManager.getInstant().getContext().getResources().getQuantityString(exp$g.ˎ, i, new Object[]{Integer.valueOf(i)}));
        if (this.ˋ != null) {
            eqx.ˏ(this.ˋ, campaignSectionCardItemBean.ॱˌ(), "app_default_icon");
        }
        LayoutParams layoutParams = (LayoutParams) this.ʼ.getLayoutParams();
        int dimensionPixelOffset = this.ʼॱ.getResources().getDimensionPixelOffset(exp$a.ˎ);
        if (this.ˏ && this.ˊ) {
            layoutParams.topMargin = 0;
            layoutParams.bottomMargin = dimensionPixelOffset;
            return;
        }
        layoutParams.topMargin = dimensionPixelOffset;
        layoutParams.bottomMargin = dimensionPixelOffset;
    }

    public void ॱ(chy o_chy) {
        OnClickListener o_fcs = new fcs(o_chy, this, 0);
        this.ᐝ.setOnClickListener(o_fcs);
        ˉ().setOnClickListener(o_fcs);
    }
}
